<template>
  <a-card :bordered="false">
    <a-tabs default-active-key="1" @change="callback">
      <a-tab-pane key="1" tab="基本信息">
        <div class="company-logo">
          <img :src="companyLogo">
          <a-upload
            name="file"
            :multiple="false"
            :accept="accept"
            :showUploadList="false"
            class="uploadFile"
            :beforeUpload="uploadPic">
            <a-button style="width:100px;height:100px"><a-icon type="upload"/>上传</a-button>
          </a-upload>
        </div>
        <a-form :form="form">
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司名称">
                <a-input placeholder="请输入公司名称" v-decorator="['name', {rules:[{required:true,message:'请输入'}]}]" />
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="行业标签">
                <!-- <a-input placeholder="请输入行业标签" v-model="form.industryLabel" /> -->
                <a-input placeholder="请选择行业标签" v-show v-decorator="['labelIds', {}]" />
            <a-input placeholder="请选择行业标签" @click="showCommonModalLabel" v-decorator="['labelsName', {}]" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="注册地">
                <a-select placeholder="请选择" style="width:150px;" v-model="provsLabel" @change="getProv($event)">
                  <a-select-option :value="item.value" v-for="(item,index) in provs">{{item.label}}</a-select-option>
                </a-select>
                &nbsp;
                -
                &nbsp;
                <a-select placeholder="请选择" style="width:150px;" v-model="citysLabel">
                  <a-select-option :value="item.value" v-for="(item,index) in citys">{{item.label}}</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司地址">
                <a-input placeholder="请输入公司地址" v-decorator="['address', {}]" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="注册时间">
                <a-month-picker style="width:100%" placeholder="请选择注册时间" v-decorator="['registerTime', {}]" @change="onChange" />
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="联系电话">
                <a-input placeholder="请输入联系电话" v-decorator="['telephone', {}]" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司简介">
                <a-input type="textarea" placeholder="请输入公司简介" v-decorator="['profile', {}]" />
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="融资阶段">
                <a-select placeholder="请选择融资阶段" v-decorator="['financeStage', {}]" >
                  <a-select-option :value="item.value" v-for="(item,index) in financialRound">{{item.label}}</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司估值">
                <a-select style="width: 100%" placeholder="请选择公司估值" v-decorator="['appraisement', {}]" >
                  <a-select-option :value="item.value" v-for="(item,index) in appraisementArr">{{item.label}}</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="投资方">
                <a-input placeholder="请输入投资方" v-decorator="['investment', {}]" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司视频">
                <!-- <a-input placeholder="请输入公司视频" v-model="form.propagandaVideo" /> -->
                 <a-upload
                  name="file"
                  :multiple="false"
                  :accept="acceptVideo"
                  :showUploadList="false"
                  v-decorator="['propagandaVideo', {}]"
                  :beforeUpload="uploadPicCom">
                  <a-button><a-icon type="upload"/>上传</a-button>
                </a-upload>
                <span style="margin-left:20px;" v-for="(item,index) in fileListCom">{{item.name}}<a-icon style="cursor:pointer;margin-left:20px;" type="delete" @click="deleteFileObjCom(index)"/></span>
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="公司介绍文档">
                <!-- <a-input placeholder="请输入公司介绍文档" v-model="form.documentation" /> -->
                 <a-upload
                  name="file"
                  :multiple="false"
                  :accept="accept"
                  :showUploadList="false"
                  v-decorator="['documentation', {}]"
                  :beforeUpload="uploadPicBp">
                  <a-button><a-icon type="upload"/>上传</a-button>
                </a-upload>
                <span style="margin-left:20px;" v-for="(item,index) in fileListBp">{{item.name}}<a-icon style="cursor:pointer;margin-left:20px;" type="delete" @click="deleteFileObjBp(index)"/></span>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                class="special-action"
                label="操作">
                <a-button type="primary" @click="submitBase()">提交</a-button>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </a-tab-pane>
      <a-tab-pane key="2" tab="公司认证">
        <a-form :form="form1">
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="企业注册号">
                <a-input placeholder="请输入企业注册号" v-decorator="['registerNumber', {}]" />
              </a-form-item>
            </a-col>
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="营业执照">
                <a-upload
                  name="file"
                  :multiple="false"
                  :accept="accept"
                  :showUploadList="false"

                  v-decorator="['businessLicense', {}]"
                  :beforeUpload="uploadPicBus">
                  <a-button><a-icon type="upload"/>上传</a-button>
                </a-upload>
                <span style="margin-left:20px;" v-for="(item,index) in fileList">{{item.name}}<a-icon style="cursor:pointer;margin-left:20px;" type="delete" @click="deleteFileObj(index)"/></span>
                <!-- <a-input placeholder="请输入营业执照" v-model="form1.businessLicense" /> -->
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                  :labelCol="labelCol"
                  :wrapperCol="wrapperCol"
                  class="special-action"
                  label="操作">
                  <a-button type="primary" @click="submitBase()">提交</a-button>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </a-tab-pane>
      <!-- <a-tab-pane key="3" tab="管理员">
        <div class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">

              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <a-form-item label="公司名称">
                  <a-input placeholder="请输入公司名称" v-model="queryParam.name"></a-input>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <a-form-item label="公司主题">
                  <a-input placeholder="请输入公司主题" v-model="queryParam.theme"></a-input>
                </a-form-item>
              </a-col>
            <template v-if="toggleSearchStatus">
              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <a-form-item label="login路径">
                  <a-input placeholder="请输入login路径" v-model="queryParam.login"></a-input>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <a-form-item label="企业注册号">
                  <a-input placeholder="请输入企业注册号" v-model="queryParam.registerNumber"></a-input>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <a-form-item label="营业执照">
                  <a-input placeholder="请输入营业执照" v-model="queryParam.businessLicense"></a-input>
                </a-form-item>
              </a-col>
              </template>
              <a-col :xl="6" :lg="7" :md="8" :sm="24">
                <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                  <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
                  <a @click="handleToggleSearch" style="margin-left: 8px">
                    {{ toggleSearchStatus ? '收起' : '展开' }}
                    <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
                  </a>
                </span>
              </a-col>

            </a-row>
          </a-form>
        </div>
        <div class="table-operator">
          <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
        </div>

        <div>
          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            class="j-table-force-nowrap"
            
            @change="handleTableChange">

            <span slot="action" slot-scope="text, record">
              <a @click="handleEdit(record)">编辑</a>

              <a-divider type="vertical" />
              <a-dropdown>
                <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
                <a-menu slot="overlay">
                  <a-menu-item>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
            </span>

          </a-table>
        </div>
      </a-tab-pane> -->
      <a-tab-pane key="4" tab="主页概况">
        <div class="index-data">
          <div class="data-item">
              <p>粉丝数</p>
              <p><b>{{mainPageData.funsTotal}}</b></p>
          </div>
          <div class="data-item">
              <p>新增粉丝</p>
              <p><b>{{mainPageData.newFuns}}</b></p>
          </div>
          <div class="data-item">
              <p>浏览量</p>
              <p><b>{{mainPageData.lookCount}}</b></p>
          </div>
          <div class="data-item">
              <p>最近一周浏览量</p>
              <p><b>{{mainPageData.lookCountMonth}}</b></p>
          </div>
        </div>
        <div class="index-data">
          <div class="data-item">
              <p>动态</p>
              <p><b>{{mainPageData.dynamicCount}}</b></p>
          </div>
          <div class="data-item noOpacity">
              <p>新增粉丝</p>
              <p><b>1000</b></p>
          </div>
          <div class="data-item noOpacity">
              <p>浏览量</p>
              <p><b>1000</b></p>
          </div>
          <div class="data-item noOpacity">
              <p>最近一周浏览量</p>
              <p><b>1000</b></p>
          </div>
        </div>
      </a-tab-pane>
    </a-tabs>
    
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <company-modal ref="modalForm" @ok="modalFormOk"></company-modal>
    <commonModal
      modalTitle="请选择"
      ref="commonModalLabel"
      selectType="checkbox"
      @getCommonModalData="getCommonModalDataLabel"
      :columns="modalColumnsLabel"
      apiUrl="tc/label/list?type=1"
      :searchArr="searchArrLabel"></commonModal>
  </a-card>
</template>

<script>
  import { httpAction,postAction } from '@/api/manage'
  import '@/assets/less/TableExpand.less'
  import CompanyModal from './modules/CompanyModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import commonModal from '@/components/commonModal'
  import pick from 'lodash.pick'
  import moment from "moment"
  import axios from 'axios'
  export default {
    name: "CompanyList",
    mixins:[JeecgListMixin],
    components: {
      CompanyModal,commonModal
    },
    data () {
      return {
        appraisementArr:[{
          label:'0-100万美元',
          value:'0-100万美元'
        },{
          label:'100万-1000万美元',
          value:'100万-1000万美元'
        },{
          label:'1000万-5000万美元',
          value:'1000万-5000万美元'
        },{
          label:'5000万-1亿美元',
          value:'5000万-1亿美元'
        },{
          label:'1亿-5亿美元',
          value:'1亿-5亿美元'
        },{
          label:'5亿-10亿美元',
          value:'5亿-10亿美元'
        },{
          label:'10亿美元以上',
          value:'10亿美元以上'
        },],
        financialRound:[{
          label:'未融资',
          value:'未融资'
        },{
          label:'种子轮',
          value:'种子轮'
        },{
          label:'天使轮',
          value:'天使轮'
        },{
          label:'A轮',
          value:'A轮'
        },{
          label:'B轮',
          value:'B轮'
        },{
          label:'C轮',
          value:'C轮'
        },{
          label:'D轮',
          value:'D轮'
        },{
          label:'F轮',
          value:'F轮'
        },{
          label:'IPO上市',
          value:'IPO上市'
        },{
          label:'债券融资',
          value:'债券融资'
        },{
          label:'战略融资',
          value:'战略融资'
        },],
        provsLabel:'',
        citysLabel:'',
        citys:[],
        provs:[{label:"北京市",value:"北京市"},
        {label:"天津市",value:"天津市"},
        {label:"河北省",value:"河北省"},
        {label:"山西省",value:"山西省"},
        {label:"内蒙古自治区",value:"内蒙古自治区"},
        {label:"辽宁省",value:"辽宁省"},
        {label:"吉林省",value:"吉林省"},
        {label:"黑龙江省",value:"黑龙江省"},
        {label:"上海市",value:"上海市"},
        {label:"江苏省",value:"江苏省"},
        {label:"浙江省",value:"浙江省"},
        {label:"安徽省",value:"安徽省"},
        {label:"福建省",value:"福建省"},
        {label:"江西省",value:"江西省"},
        {label:"山东省",value:"山东省"},
        {label:"河南省",value:"河南省"},
        {label:"湖北省",value:"湖北省"},
        {label:"湖南省",value:"湖南省"},
        {label:"广东省",value:"广东省"},
        {label:"广西壮族自治区",value:"广西壮族自治区"},
        {label:"海南省",value:"海南省"},
        {label:"重庆市",value:"重庆市"},
        {label:"四川省",value:"四川省"},
        {label:"贵州省",value:"贵州省"},
        {label:"云南省",value:"云南省"},
        {label:"西藏自治区",value:"西藏自治区"},
        {label:"陕西省",value:"陕西省"},
        {label:"甘肃省",value:"甘肃省"},
        {label:"青海省",value:"青海省"},
        {label:"宁夏回族自治区",value:"宁夏回族自治区"},
        {label:"新疆维吾尔自治区",value:"新疆维吾尔自治区"},
        {label:"台湾省",value:"台湾省"},
        {label:"香港特别行政区",value:"香港特别行政区"},
        {label:"澳门特别行政区",value:"澳门特别行政区"}] ,
        mainPageData:{},
        searchArrLabel: [
            { label: '关键字搜索', key: 'label' }
        ],
        modalColumnsLabel: [
            { title: '名称', dataIndex: 'label' },
        ],
        accept: '*',
        acceptVideo:'video/*',
        fileList:[],
        fileListCom:[],
        fileListBP:[],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        form: this.$form.createForm(this),
        form1: this.$form.createForm(this),
        companyLogo:'',
        description: '公司管理管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
		   {
            title: '公司名称',
            align:"center",
            dataIndex: 'name'
           },
		   {
            title: '公司主题',
            align:"center",
            dataIndex: 'theme'
           },
		   {
            title: 'login路径',
            align:"center",
            dataIndex: 'login'
           },
		   {
            title: '企业注册号',
            align:"center",
            dataIndex: 'registerNumber'
           },
		   {
            title: '营业执照',
            align:"center",
            dataIndex: 'business license'
           },
		   {
            title: '注册地',
            align:"center",
            dataIndex: 'registerAddress'
           },
		   {
            title: '公司地址',
            align:"center",
            dataIndex: 'address'
           },
		   {
            title: '简介',
            align:"center",
            dataIndex: 'profile'
           },
		   {
            title: '阶段',
            align:"center",
            dataIndex: 'financeStage'
           },
		   {
            title: '企业微信',
            align:"center",
            dataIndex: 'enterpriseWechat'
           },
		   {
            title: '工商信息地址',
            align:"center",
            dataIndex: 'businessInfo'
           },
		   {
            title: '融资金额',
            align:"center",
            dataIndex: 'financeAmount'
           },
		   {
            title: '估值',
            align:"center",
            dataIndex: 'appraisement'
           },
		   {
            title: '投资方',
            align:"center",
            dataIndex: 'investment'
           },
		   {
            title: '宣传视频地址',
            align:"center",
            dataIndex: 'propagandaVideo'
           },
		   {
            title: '资料文档/公司BP',
            align:"center",
            dataIndex: 'documentation'
           },
		   {
            title: '公司logo',
            align:"center",
            dataIndex: 'logoPath'
           },
		   {
            title: '注册时间',
            align:"center",
            dataIndex: 'registerTime'
           },
		   {
            title: '联系电话',
            align:"center",
            dataIndex: 'telephone'
           },
		   {
            title: '转发次数',
            align:"center",
            dataIndex: 'forwardCount'
           },
		   {
            title: '评论次数',
            align:"center",
            dataIndex: 'commentCount'
           },
		   {
            title: '点赞次数',
            align:"center",
            dataIndex: 'fabulousCount'
           },
		   {
            title: '创建人',
            align:"center",
            dataIndex: 'createUser'
           },
		   {
            title: '更新人',
            align:"center",
            dataIndex: 'updateUser'
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
		url: {
          list: "/tc/company/list",
          add:"/tc/company/add",
          edit:"/tc/company/edit",
          delete: "/tc/company/delete",
          deleteBatch: "/tc/company/deleteBatch",
          exportXlsUrl: "tc/company/exportXls",
          importExcelUrl: "tc/company/importExcel",
          updateFile:"tc/company/upload"
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
  created(){
    
    let companyId = (localStorage.getItem('userInfo') && JSON.parse(localStorage.getItem('userInfo')))?JSON.parse(localStorage.getItem('userInfo')).companyId:'';
    if(!companyId){
      return false;
    }
    this.getData();
    this.getCompanyData();
  },
    methods: {
        getProv(prov,cityLabel){
          
          axios.get('/city.json')
          .then((response) => {
            let tempCity=[];
             this.citys=[];
             if(!cityLabel){
              this.citysLabel=''; 
             }
            let allCity = response.data;
            for (var val of allCity){
              if (prov == val.prov){
               console.log(val);
               tempCity.push({label: val.label, value: val.label})
              }
             }
             this.citys = tempCity;
          })
          .catch(function (error) { // 请求失败处理
            console.log(error);
          });
        },
       getCompanyData(){

        let httpurl = '/tc/company/companyByUser';
        let method = 'get';
        
        let formData = {};
        //时间格式化
        
        console.log(formData)
        let id = localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).id:'';
        httpurl = httpurl+'?id='+id;
        this.fileListCom = [];
        this.fileListBp = [];
        this.fileList = [];
        httpAction(httpurl,{},method).then((res)=>{
          if(res.success){
            // this.model = res.result
            this.form.resetFields();
            this.form1.resetFields();
            this.model = Object.assign({}, res.result);
            let labelsName = [];
            let labelIds = [];
            if(res.result){
              res.result.labels.forEach((e)=>{
                labelsName.push(e.label);
                labelIds.push(e.id);
              })
            }
            let json = localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')):{};
            json.companyId = res.result.id;
            json.companyName = res.result.name;
            localStorage.setItem('userInfo',JSON.stringify(json));
            this.$nextTick(() => {
              this.companyLogo = this.model.logoPath;
              this.model.labelsName = labelsName.join(',')
              this.model.labelIds = labelIds;
              this.fileListCom.push({name:this.model.propagandaVideo})
              this.fileListBp.push({name:this.model.documentation})
              this.fileList.push({name:this.model.businessLicense})
              this.form.setFieldsValue(pick(this.model,'logoPath','labelIds','labelsName','companyId','address','name','theme','telephone','investment','industryName','financeStage','profile','registerAddress','financeAmount','propagandaVideo','documentation','appraisement'))
              
              console.log('ggggggggggggggg',this.model)
              if(this.model.registerAddress){
                this.provsLabel = this.model.registerAddress.split('-')[0];
                this.citysLabel = this.model.registerAddress.split('-')[1];
                this.getProv(this.provsLabel,this.citysLabel)
              }
              this.form1.setFieldsValue(pick(this.model,'registerNumber','businessLicense'))
              //时间格式化
              this.form.setFieldsValue({registerTime:this.model.registerTime?moment(this.model.registerTime):null})
            });
            // that.$emit('ok');
          }else{
            this.$message.warning(res.message);
          }
        }).finally(() => {
          // that.confirmLoading = false;
          // that.close();
        })
      },
      showCommonModalLabel () {
          this.$refs.commonModalLabel.open()
      },
      getCommonModalDataLabel(val){
        if (val.length > 0) {
              console.log('数组第一个对象', val[0])
              let labelsName = [];
              let labelIds = [];
              val.forEach((e)=>{
                labelIds.push(e.id);
                labelsName.push(e.label)
              })
              this.form.setFieldsValue({
                  labelsName: labelsName.join(','),
                  labelIds:labelIds
              })
          }
      },
      submitBase(){
        let httpurl = '';
        this.model = this.model?this.model:{};
        let formData = Object.assign(this.model,this.form.getFieldsValue(),this.form1.getFieldsValue());
        let method = ''
        if(this.model.id){
          httpurl = this.url.edit;
          method = 'put'
        }else{
          httpurl = this.url.add;
          method = 'post'
        }
        formData.logoPath = this.companyLogo;
        formData.registerTime = formData.registerTime?formData.registerTime.format('YYYY-MM-DD HH:mm:ss'):null;
        if(this.provsLabel || this.citysLabel){
          formData.registerAddress = (this.provsLabel?this.provsLabel:'')+'-'+(this.citysLabel?this.citysLabel:'');
        }
          
        
        httpAction(httpurl,formData,method).then((res)=>{
          if(res.success){
            this.getCompanyData();
            
            this.$message.success(res.message);
          }else{
            this.$message.warning(res.message);
          }
        }).finally(() => {
        })
      },
      uploadPic(fileObj){
        let httpurl = this.url.updateFile;
        let formData = new FormData();
        formData.append('file',fileObj)
        let that = this;
        postAction(httpurl,formData).then((res)=>{
          if(res.success){
            that.$message.success('上传成功');
            this.companyLogo = res.message;
            console.log('gggg',this.companyLogo)
          }else{
            that.$message.warning(res.message);
          }
          that.confirmLoading = false;
        }).catch(() => {
          that.confirmLoading = false;
          this.$message.error('文件过大或网络出错')
          // that.close();
        })
        return false;
      },
      getData(){
        this.mainPageData = {};
        httpAction('/tc/company/statistics',{},'GET').then((res)=>{
          if(res.success){
            this.mainPageData = res.result?res.result:{};
          }
        }).catch((e)=>{

        })
      },
      callback(key) {
        console.log(key);
        if(key == 2){
          this.model = this.model?this.model:{};
          this.form1.resetFields();
          this.$nextTick(()=>{
            this.form1.setFieldsValue(pick(this.model,'registerNumber','businessLicense'))
          })
        }
        
      },
      deleteFileObj(index){
        this.fileList = [];
        this.form1.setFieldsValue({
                businessLicense: '',
            })
      },
      uploadPicBus(fileObj){
        let httpurl = this.url.updateFile;
        let formData = new FormData();
        formData.append('file',fileObj)
        let that = this;
        this.fileList = [];
        postAction(httpurl,formData).then((res)=>{
          if(res.success){
            that.$message.success('上传成功');
            // this.form1.businessLicense = res.message;
            this.form1.setFieldsValue({
                businessLicense: res.message,
            })
            this.fileList.push({name:fileObj.name})
            console.log('ssss',this.fileList)
          }else{
            that.$message.warning(res.message);
          }
        }).catch(() => {
          that.confirmLoading = false;
          this.$message.error('文件过大或网络出错')
          // that.close();
        })
        return false;
      },
      deleteFileObjCom(index){
        this.fileListCom = [];
        // this.form.propagandaVideo = '';
        this.form.setFieldsValue({
                propagandaVideo: '',
            })
      },
      uploadPicCom(fileObj){
        let httpurl = this.url.updateFile;
        let formData = new FormData();
        formData.append('file',fileObj)
        let that = this;
        this.fileListCom = [];
        postAction(httpurl,formData).then((res)=>{
          if(res.success){
            that.$message.success('上传成功');
            // this.form.propagandaVideo = res.message;
            this.form.setFieldsValue({
                propagandaVideo: res.message,
            })
            this.fileListCom.push({name:fileObj.name})
            console.log('ssss',this.fileListCom)
          }else{
            that.$message.warning(res.message);
          }
        }).catch(() => {
          that.confirmLoading = false;
          this.$message.error('文件过大或网络出错')
          // that.close();
        })
        return false;
      },
      deleteFileObjBp(index){
        this.fileListBp = [];
        // this.form.documentation = '';
        this.form.setFieldsValue({
                documentation: '',
            })
      },
      uploadPicBp(fileObj){
        let httpurl = this.url.updateFile;
        let formData = new FormData();
        formData.append('file',fileObj)
        let that = this;
        this.fileListBp = [];
        postAction(httpurl,formData).then((res)=>{
          if(res.success){
            that.$message.success('上传成功');
            // this.form.documentation = res.message;
            this.form.setFieldsValue({
                documentation: res.message,
            })
            this.fileListBp.push({name:fileObj.name})
            console.log('ssss',this.fileList)
          }else{
            that.$message.warning(res.message);
          }
        }).catch((e) => {
          that.confirmLoading = false;
          // that.close();
          this.$message.error('文件过大或网络出错')
        })
        // return false;
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .index-data{
    display: flex;
    justify-content: space-around;
    padding:20px 0px;
    background-color: #efefef;
    margin-bottom: 20px;
  }
  .index-data .data-item{
    width: 100px;
    display: inline-block;
  }
  .index-data .data-item p{
    line-height: 30px;
    height: 30px;
    overflow: hidden;
    text-align: center;
  }
  .noOpacity{
    opacity: 0;
  }
  .company-logo{
    width: 100px;
    margin:20px auto;
    position: relative;
    height: 100px;
    background-color:#f1f1f1;
    border-radius:50%;
  }
  .company-logo img{
    width: 100%;
    height:100px;
  }
  .uploadFile{
    position: absolute;
    width:100%;
    height: 100%;
    left: 0px;
    top:0px;
    opacity: 0;
  }
</style>